import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Films from '../views/Films.vue'
import Cinemas from '../views/Cinemas.vue'
import Board from '../views/Board.vue'
import User from '../views/User.vue'
import Xseats from '../views/Xseats.vue'
import Order from '../views/Order.vue'
import Pay from '../views/Pay.vue'
import Search from '../views/Search.vue'
import Buy from '../views/Buy.vue'
import File from '../views/File.vue'

Vue.use(VueRouter)

const routes = [
    // 首页
    {
        path: '/',
        name: 'Home',
        component: Home
    },
    // 电影列表
    {
        path: '/films',
        name: 'Films',
        component: Films,
    },
    {
        path: '/films/:id',
        name: 'FilmDetail',
        component: () => import('../views/FilmDetail.vue'),
    },
    // 影院列表
    {
        path: '/cinemas',
        name: 'Cinemas',
        component: Cinemas
    },
    {
        path: '/cinemas/:id',
        name: 'CinemasDetail',
        component: () => import('../views/CinemasDetail.vue'),
    },
    // 榜单
    {
        path: '/board',
        name: 'Board',
        component: Board
    },
    // 个人中心
    {
        path: '/user',
        component: User,
        children: [
            {
                path: '',
                name: 'User',
                component: () => import('../components/user/User.vue')
            },
            {
                path: 'login',
                name: 'Login',
                component: () => import('../components/user/Login.vue')
            }, {
                path: 'register',
                name: 'Register',
                component: () => import('../components/user/Register.vue')
            }
        ]
    },
    // 选座
    {
        path: '/xseats',
        name: 'Xseats',
        component: Xseats
    },
    // 订单
    {
        path: '/order',
        name: 'Order',
        component: Order
    },
    // 付款
    {
        path: '/pay',
        name: 'Pay',
        component: Pay
    },
    // 搜索
    {
        path: '/search',
        name: 'Search',
        component: Search
    },
    {
        path: '/films/buy/:id',
        name: 'Buy',
        component: Buy,
    },
    {
        path: '/file',
        name: 'File',
        component: File,
    },
]

const router = new VueRouter({
    routes
})

export default router
